package com.mapbased.sfw.ses;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;

public class SessionStore {

	AtomicInteger seq = new AtomicInteger();
	private ConcurrentMap<String, Session> sessions = new ConcurrentHashMap<String, Session>();

	public Session getSession(String sid) {

		return this.sessions.get(sid);
	}

	public void putSession(String sid, Session ses) {
		this.sessions.putIfAbsent(sid, ses);
	}

	public String generateSessionId() {
		return seq.incrementAndGet() + "";
	}

}
